Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split out the tags into separate FuseProperty objects with the same weight #170

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

deweyx
Copy link

@deweyx deweyx commented Sep 17, 2020

When I put together #166 (thanks for merging BTW!) I hadn't noticed the Collapse.js script, though I had searched for "join" which is one of the tags on that script. Maybe it's partly because it's last in the list?

This PR seems to fix search by any tag, even if it's later in a long list.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@deweyx
Copy link
Author

deweyx commented Sep 17, 2020

I've been playing with this; the main thing I don't like is the tags now tend to take precedence over the titles, even with the relative weights. This appears to be because of Fuse's concept of distance, the reason I couldn't find what I was looking for in the first place. An example is searching for "decode", which would pull up QueryToJson.js as the first result based on the tag.

I think weighting the titles quite higher than one might be called for.

private static func parseTerms(terms: String?) -> [String] {
// reurn either an empty array or the terms split by comma space or semicolon
terms?.components(separatedBy: CharacterSet(charactersIn: ",; ")) ?? [String]()
}
}

extension Script: Fuseable {

var properties: [FuseProperty] {
return [
FuseProperty(value: name, weight: 0.9),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a weight of 1.5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant